<%@ page pageEncoding="UTF-8"%>
<%@ page contentType="text/html; charset=UTF-8"%>
<%@taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<jsp:include page="common/header.jsp"></jsp:include>
<style>
.bloc .tab_edit{float:left;width:100%;border:2px solid #ccc;height:50px;margin-bottom:20px;margin-top:2px;}
.bloc .tab_edit li{float:left;width:24.9%;}
.bloc .tab_edit li:hover,.bloc .tab_edit li.current{background:#ccc;}
.bloc .tab_edit a{float:left;display:block;width:100%;text-align:center;border-right:2px solid #ccc;height:50px;text-decoration:none;color:#333 !important;font-size:16px;font-weight:bold;line-height:50px;}
.bloc .tab_edit a:hover{text-decoration:none !important;}
#twitterlist img{margin:13px !important;}
.input input{color:#333 !important;font-weight:normal !important;cursor:auto !important;text-shadow:none !important;}
.input input:hover{background:#fff !important;}
		div.selector{
				overflow: inherit !important;
			}
			#sabe{
				opacity: 0 !important;
			}
</style>
<input type="hidden" name="projectName" id="projectName" value="${pageContext.request.contextPath }"/>
<h1>
	<img src="${pageContext.request.contextPath}/views/images/icons/posts.png" alt="" /> 添加新会员
</h1>
<div class="bloc">
		<div class="content">
			<form:form  commandName="model" modelAttribute="model" onsubmit="return checkForm();"
			action="${pageContext.request.contextPath}/admin-salonVipUser/saveorupdate" method="post">
						<div class="input">
						<label for="input1">会员手机号码</label>
							<form:input path="mobile"  id="mobile" maxlength="11" onblur="checkMobile(this.value);" required="required"/>
						</div>
						<div class="input">
						<label for="input1">会员姓名</label>
							<form:input path="name" id="name" required="required"/>
						</div>
						<div class="input">
						<label for="input1">会员卡号</label>
							<form:input path="card" id="card" required="required"/>
						</div>
						<div class="input">
						<label for="input1">性别</label>
						</div>
						<form:select path="sex" id="sex" required="required">
							<option value="0">女</option>
							<option value="1">男</option>
						</form:select>
						<div class="input">
						<label for="input1">充值金额</label>
							<form:input path="account" id="account" onblur= "onlyFloat();"  required="required"/>
						</div>
				<div class="submit" style="margin-top: 20px;">
					<input type="submit" value="添加"/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
					<input type="reset" value="取消" class="white" onClick="javascript :history.go(-1);"/>
				</div>
			</form:form>
		</div>
	
</div>
<script type="text/javascript">
var curPageName = "admin-salonVipUser";
changeCurrent();

/**
 * @Description 校验form
 */
function checkForm(){
	if(!checkMobile($("#mobile").val())){
		return false;
	}
	if(!onlyFloat()){
		return false;
	}
	return true;
}
function checkMobile(str) {  
    if(str==""){  
    	myAlert("手机号不能为空！"); 
        return false;
    }  
    else{  
        var re = /^1\d{10}$/;                            
        if (re.test(str)) {  
        } else {  
        	myAlert("手机号格式错误！");  
            return false;
        }  
    } 
    return true;
} 
function onlyFloat(){
	var re = /^\d*(?:.\d{0,2})?$/;
	if( ! re.test($("#account").val())){
		myAlert('只能输入数字，小数点后只能保留两位');
		return false;
	}
	return true;
}

</script>
